Repository navigation
feat(tools): verify the CLIs kit says it manages — version, provenance, currency - #504
Merged
Merged
Conversation
…e, currency Three defects, one root: nothing resolved a declared tool to an actual version, an actual installer, or a known-latest, and the output made an unverified pass indistinguishable from a verified pin (#500). 1. `latest` was compared against nothing — `versionSatisfies` returned true for it before looking, so `✓ vercel 53.1.1 (need latest)` printed while the registry had 59.1.4. `latest` now means CURRENT: the newest version the tool's own installer would give, with drift shown as `! 0.72.0 → 0.74.0 available`. A pin of any/present/* asserts presence only, and says so. 2. cli-lock.json recorded a provenance it never measured. Both writers did `tools[name] = { version, source: "mise" }` — the declared string as the version, the installer hardcoded — so an entry said mise for a binary in /opt/homebrew/bin, and the check compared names only and called it in sync. Now the version is resolved, the source is classified from the path, sourceDetail carries installers the lock's four-value vocabulary cannot name, and a contradiction fails the row. 3. Undeclared CLIs were invisible. `kit tools list [--latest] [--json]` inventories the declared [tools] plus the ones an agent decides from (gh, op, jq, mise, docker, gcloud, kubectl, supabase, stripe, psql, …). The two load-bearing rules, both from kit's own no-false-green stance: - a lookup that cannot run reports WHY and never passes — air-gap, an installer with no registry kit can query, a kit PATH shim (it delegates), a timeout; - the gate does not call registries. `kit check` reads the cache only and says "not looked up yet — run `kit tools list --latest`" when it is cold, so the check never becomes slow or network-dependent. A failed lookup is not cached: a flaky network must not become a day-long policy. Found while building it: prefixed declarations (aqua:owner/name, npm:@scope/pkg) were probed as literal strings, so installed tools reported as not installed — the same false statement pointed the other way. And adding a verb tripped kit's own counted claims (mcp-server.ts and MCP_TOOLS_GUIDE.md both said 71 commands); the invariant worked, the counts are now 72 and the contracts are regenerated. Requirement 5 (an upgrade path per installer) is deliberately out: it is a mutating command with its own consent and read-only-surface questions, and it belongs with `kit upgrade`, not bolted to a reporting change. Closes #500 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
✅ Docker image built successfully
|
kit's test-coverage gate flagged src/commands/tools.ts as a net-new untested file. The tests it was missing are the ones about the output an operator and a script actually read: the default lists with a source column and says currency was NOT checked (silence there would read as checked-and-fine), an unknown subcommand refuses instead of quietly listing, --json is pure JSON with currency null until asked, and paths appear only under KIT_TOOLS_PATHS=1.
|
✅ Docker image built successfully
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #500 (requirements 1–4 and 6; 5 is scoped out below).
The three defects, and what each one now does
1.
latestwas compared against nothing.so
✓ vercel 53.1.1 (need latest)printed while the registry said 59.1.4. Nowlatestmeans current, and the tools table says which installer owns the binary and how far behind it is:A pin of
any/present/*asserts presence only — the honest name for whatlatestused to do, for repos that mean it.2.
cli-lock.jsonrecorded a provenance it never measured, and the check called itin sync.Both writers did the same thing —
tools[name] = { version, source: "mise" }— recording the declared string as the version and hardcoding the installer. The lock check compared names only. Now the version is the resolved one, the source is classified from the resolved path,sourceDetailcarries installers the lock's four-value vocabulary cannot name (brew,system,cargo,kit-shim), and a contradiction fails the row:3. Undeclared CLIs were invisible. New
kit tools list [--latest] [--json]inventories the declared[tools]plus the tools an agent actually decides from —gh,op,jq,mise,docker,gcloud,kubectl,supabase,stripe,psql,git,node,npm,python3,vercel,convex. Not "everything on PATH": an inventory nobody reads is the same failure one level up.Measured on the reporting machine, first run:
trivy 0.72.0 → 0.74.0,trufflehog 3.95.9 → 3.97.0,gh 2.96.0 → 2.97.0,mise 2026.6.11 → 2026.8.9,npm 10.9.8 → 12.0.2,op 2.34.0 → 2.39.0.vercelreads✓ 59.1.4— it was upgraded between the report and this branch, which is why the drift class is demonstrated on the six above instead.Requirement 3 and 6 are the load-bearing parts
An unrunnable check reports why, and never passes. Four distinct outcomes, each with its own reason string: air-gap (no call made), an installer with no registry kit can query (
system,cargo,go), a kit PATH shim (the shim delegates — asking about it would answer about the wrong thing), and a lookup that timed out or returned nothing parseable.The gate does not call registries.
kit checkuses a cache-only reader: it reports drift the cache already knows and otherwise says so —kit tools list --latestis what fills the cache (~/.kit/tool-latest.json, TTL viaKIT_TOOL_LATEST_TTL_H, default 24h). Cold 12s, warm 4s, and a failed lookup is deliberately not cached — a flaky network must not become a day-long policy.Two defects found while building it
[tools]carries backend prefixes, and the probe used the raw declaration, sokit tools listsaid✗ aqua:aquasecurity/trivy not installedwhile trivy 0.72.0 sat on PATH. Same false statement as kit check reports ✓ for tools it never verified: "latest" means "on PATH", cli-lock claims a provenance it does not own, and undeclared CLIs are invisible #500, pointed the other way;probeName()fixes it in both the inventory and the check.command-surface.test.ts:src/mcp-server.tsanddocs/MCP_TOOLS_GUIDE.mdboth state the command count, and both said 71. The invariant worked — updated to 72, with the contracts regenerated (gen-public-surface.mjs,gen-opencli.mjs).Tests
tool-provenance.test.ts(12) — every installer classified from the real paths on the reporting machine; shim vs installs-path; ordering regressions (kit shim and mise both live under$HOME, Homebrew is reached through/opt/homebrew/binsymlinks); win32 case-insensitivity; andprovenanceMismatchcatching the exactmise-for-brew case while never alarming on a shim or an unclassifiable path.tool-latest.test.ts(16) — cache hit makes no subprocess; TTL expiry re-asks; air-gap and cache-only each report their own reason; unsupported installers name themselves; a failed lookup is not cached; brew's JSON is parsed rather than the first number in its chatter; andcompareVersionsnumerically (53.1.1 < 59.1.4,9.0.0 < 10.0.0).tool-inventory.test.ts(10) —probeNameacross backends,toLockSourcemapping everything unnameable tomanualinstead of guessingmise, and the compiled CLI asserting that every listed tool has a measured source and that nothing claimsmisefor a path outside mise.Scoped out, deliberately
brew upgradevsmise upgradevsnpm -g) — that is a mutating command with its own consent and read-only-surface questions, and it belongs withkit upgrade's existing machinery rather than bolted to a reporting change.Verification
npm test: 4388 tests, 0 fail, 0 skipped (macOS, non-root)kit self-audit: 16 rules, 0 fail, 0 warn ·eslint src: 0 errors ·prettier --check "src/**/*.ts"cleankit checkexercised warm and cold;kit tools listand--latestexercised against real brew/mise/npm🤖 Generated with Claude Code